package com.wengzw.service;
import com.wengzw.dao.UserMapper;
import com.wengzw.po.User;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
@Transactional
public class UserServiceImpl implements UserService {
    /**
     * 登陆
     * @param user_name
     * @param user_password
     * @return
     */
    @Resource
    private UserMapper userMapper;
    public User login(String user_name, String user_password) {
        //调用根据用户名查询用户信息
        User user = userMapper.findUserByLoginName(user_name);
        // String newPassword = PasswordUtil.md5(user_password,user.getUser_name(),5);
        if(user.getUser_name().equals(user_name) &&  user.getUser_password().equals(user_password)){
            return user;
        }
        return null;
    }
}

